package assignment10;

import java.io.*;

public class FileRead {
public static void main(String[] args)  throws IOException {
	String filename = "G:\\Users\\IOtest\\test.txt";
	//FileStream --- 操作文件
	//BufferStream --- 操作数数据流
    BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename));
    PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream("G:\\Users\\IOtest\\out.txt")));
    
    //标准输入输出错误都是PrintStream类型的
    //重定向
    System.setIn(in);
    System.setOut(out);
    System.setErr(out);

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s;
    while((s = br.readLine()) != null)   
    	System.out.println(s);
    out.close(); // Remember this!
  }
} 